<?php
/* This is an example processing file for a main page. */

// This allows access to the system and template folder files.
set_include_path('system'.PATH_SEPARATOR.'templates'); 

// These load the template engine, database manager, and redirect exception
require_once('Template.php');
require_once('RedirectBrowserException.php');
require_once('DatabaseUtility.php');

// This creates the template engine
$tmpl = new Template();

/*** DO ALL GET AND POST REQUESTS HERE ***/
$example = $_GET['example'];

// Open database connection.
openDatabase();

	/*** DO ALL DATABASE QUERIES HERE ***/
	$query = "SELECT version FROM p3dbInfo";
	$result = runQuery($query);
	$version = $result[0]['version'];
	
// close database connection.
closeDatabase();

/*** PUT ALL VARIABLES USED BY TEMPLATE HERE ***/
$tmpl->example = $example;

// This tells the page what menu item to highlight in the main menu bar.
$tmpl->current = 'example';

// This builds the content of the page
$tmpl->pageContent = $tmpl->build('example.tmpl');

// This inserts the content into the page template and then outputs the complte document.
print $tmpl->build('page.tmpl');
?>